<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
<!--    解决出现模板渲染的问题-->
    <style type="text/css">
        [v-cloak] {
            display:none;
        }
    </style>
</head>
<body>
<div id="app">
    <h1 v-cloak>{{currentTime1()}}</h1>
    <h1 v-cloak>{{currentTime2}}</h1>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
    var vm = new Vue({
        el:"#app",
        data: {
            message: "hello time"
        },
        methods: {
            currentTime1() {
                return Date.now();      //放回当前的时间戳
            }
        },
        computed: {
            //计算属性
            currentTime2() {
                return Date.now();      //放回当前的时间戳
            }
        }
    });
</script>
</body>
</html>
